import 'package:baselib/utils/res_init_util.dart';
import 'package:flustars_flutter3/flustars_flutter3.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

/**
 * 此种构造最好不要用于switch方法里面
 */
class PxBaseUtil {
  static PxBaseUtil instance = _getInstance();
  static PxBaseUtil _getInstance() {
    if (instance == null) {
      instance = PxBaseUtil();
    }
    return instance;
  }

  // static final PxBaseUtil _singleton = PxBaseUtil._internal();
  //
  // static PxBaseUtil get instance => PxBaseUtil();
  //
  //
  // factory PxBaseUtil() {
  //   return _singleton;
  // }
  //
  // PxBaseUtil._internal(){
  //   //做一些操作
  //
  // }

  final px_0 = ResInitUtil.singleton.setSize(0.0);
  final px_0d5 = ResInitUtil.singleton.setSize(0.5);
  final px_0d8 = ResInitUtil.singleton.setSize(0.8);
  final px_1 = ResInitUtil.singleton.setSize(1.0);
  final px_2 = ResInitUtil.singleton.setSize(2.0);
  final px_3 = ResInitUtil.singleton.setSize(3.0);
  final px_4 = ResInitUtil.singleton.setSize(4.0);
  final px_5 = ResInitUtil.singleton.setSize(5.0);
  final px_6 = ResInitUtil.singleton.setSize(6.0);
  final px_8 = ResInitUtil.singleton.setSize(8.0);
  final px_9 = ResInitUtil.singleton.setSize(9.0);
  final px_10 = ResInitUtil.singleton.setSize(10.0);
  final px_12 = ResInitUtil.singleton.setSize(12.0);
  final px_14 = ResInitUtil.singleton.setSize(14.0);
  final px_15 = ResInitUtil.singleton.setSize(15.0);
  final px_16 = ResInitUtil.singleton.setSize(16.0);
  final px_17 = ResInitUtil.singleton.setSize(17.0);
  final px_17d5 = ResInitUtil.singleton.setSize(17.5);
  final px_18 = ResInitUtil.singleton.setSize(18.0);
  final px_20 = ResInitUtil.singleton.setSize(20.0);
  final px_21 = ResInitUtil.singleton.setSize(21.0);
  final px_22 = ResInitUtil.singleton.setSize(22.0);
  final px_30 = ResInitUtil.singleton.setSize(30.0);
  final px_35 = ResInitUtil.singleton.setSize(35.0);
  final px_39 = ResInitUtil.singleton.setSize(39.0);
  final px_39d5 = ResInitUtil.singleton.setSize(39.5);
  final px_40= ResInitUtil.singleton.setSize(40.0);
  final px_41= ResInitUtil.singleton.setSize(41.0);
  final px_43= ResInitUtil.singleton.setSize(43.0);
  final px_44= ResInitUtil.singleton.setSize(44.0);
  final px_46 = ResInitUtil.singleton.setSize(46.0);
  final px_48 = ResInitUtil.singleton.setSize(48.0);
  final px_55 = ResInitUtil.singleton.setSize(55.0);
  final px_58 = ResInitUtil.singleton.setSize(58.0);
  final px_65 = ResInitUtil.singleton.setSize(65.0);
  final px_78 = ResInitUtil.singleton.setSize(78.0);
  final px_80 = ResInitUtil.singleton.setSize(80.0);
  final px_91 = ResInitUtil.singleton.setSize(91.0);
  final px_140 = ResInitUtil.singleton.setSize(140.0);
  final px_164 = ResInitUtil.singleton.setSize(164.0);
  final px_203 = ResInitUtil.singleton.setSize(203.0);
  final px_212 = ResInitUtil.singleton.setSize(212.0);
  final px_400 = ResInitUtil.singleton.setSize(400.0);

  final screenWidth =
      ResInitUtil.singleton.setSize(ScreenUtil.getInstance().screenWidth);
  final screenHeight =
      ResInitUtil.singleton.setSize(ScreenUtil.getInstance().screenHeight);
  final statusBarHeight =
      ResInitUtil.singleton.setSize(ScreenUtil.getInstance().statusBarHeight);
  final appBarHeight =
  ResInitUtil.singleton.setSize(ScreenUtil.getInstance().appBarHeight);
  final bottomBarHeight =
  ResInitUtil.singleton.setSize(ScreenUtil.getInstance().bottomBarHeight);

  //统一在这里做适配处理
  // static double ResInitUtil.singleton.setSize(double dp, {BuildContext context}) {
  //   return ScreenUtil.getAdapterSizeCtx(context ?? Get.context, dp);
  // }
}
